/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package at.prospect.manualcreator.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author haui
 */
@Entity
@Table(name = "MANUAL_FRAGE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ManualFrage.findAll", query = "SELECT m FROM ManualFrage m"),
    @NamedQuery(name = "ManualFrage.findById", query = "SELECT m FROM ManualFrage m WHERE m.id = :id"),
    @NamedQuery(name = "ManualFrage.findByBeschreibung", query = "SELECT m FROM ManualFrage m WHERE m.beschreibung = :beschreibung"),
    @NamedQuery(name = "ManualFrage.findByErklaerung", query = "SELECT m FROM ManualFrage m WHERE m.erklaerung = :erklaerung")})
public class ManualFrage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy=GenerationType.AUTO)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 400)
    @Column(name = "BESCHREIBUNG")
    private String beschreibung;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1200)
    @Column(name = "ERKLAERUNG")
    private String erklaerung;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "manualFrageNr")
    private Collection<ManualManualFrageZuordnung> manualManualFrageZuordnungCollection;

    public ManualFrage() {
    }

    public ManualFrage(Integer id) {
        this.id = id;
    }

    public ManualFrage(Integer id, String beschreibung, String erklaerung) {
        this.id = id;
        this.beschreibung = beschreibung;
        this.erklaerung = erklaerung;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getBeschreibung() {
        return beschreibung;
    }

    public void setBeschreibung(String beschreibung) {
        this.beschreibung = beschreibung;
    }

    public String getErklaerung() {
        return erklaerung;
    }

    public void setErklaerung(String erklaerung) {
        this.erklaerung = erklaerung;
    }

    @XmlTransient
    public Collection<ManualManualFrageZuordnung> getManualManualFrageZuordnungCollection() {
        return manualManualFrageZuordnungCollection;
    }

    public void setManualManualFrageZuordnungCollection(Collection<ManualManualFrageZuordnung> manualManualFrageZuordnungCollection) {
        this.manualManualFrageZuordnungCollection = manualManualFrageZuordnungCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ManualFrage)) {
            return false;
        }
        ManualFrage other = (ManualFrage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "at.prospect.manualcreator.ManualFrage[ id=" + id + " ]";
    }
    
}
